/*
 * Copyright 2001-2006 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.training.killerapp;

import java.util.Iterator;

import com.training.killerapp.model.Page;
import com.training.killerapp.model.User;

/**
 * Interface for the Killer App.
 * 
 * @since 1.0
 */
public interface KillerApp
{
	/**
	 * Creates a new User and Page in the Killer App.
	 * 
	 * @param email the unique email for the User
     * @param password the user's password
     * @param name the user's display name
     * 
     * @throws SecurityException
	 */
    User createAccount( String email, String password, String name );

    /**
     * Retrieves an existing User in the Killer App.
     * 
     * @param email the key of the User to get
     */
    User getUser( String email );

    /**
     * Adds friend to an existing User in the Killer App.
     * 
     * @param user the User entry to add friend to - email must be set
     * @param friendEmail the email for the User friend
     */
    void addFriend( User user, String friendEmail );

    /**
     * Updates a page in the Killer App.
     *
     * @param owner the owner of the page to manage
     * @param name the name to set for the managed page
     * @param contents the content to set for the managed page
     *
     * @return the updated Page
     */
    Page managePage( User owner, String name, String contents );

    /**
     * Retrieves a User's page in the Killer App.
     * 
     * @param ownerEmail the owner's email of the page to retrieve
     */
    Page getPage( String ownerEmail );

    void removeUserAndPage( User user );

    Iterator getUserIterator();
}
